package com.example.demo.utils;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Administrator
 * @className wuyp
 * @description:
 * @Date 2022/3/31 14:47
 **/
public class Nodes {
    List<TreeNode> childNode =new ArrayList<TreeNode>();
    List<TreeNode> lastChilNode =new ArrayList<TreeNode>();
    public  List<TreeNode> treeMenulist(List<TreeNode> treeNodes,int pid){

        List<TreeNode> tempTreeNode =new ArrayList<TreeNode>();
        List<TreeNode> tempTreeNode1 =new ArrayList<TreeNode>();
        for(TreeNode node:treeNodes){
            if(node.getId() ==pid){
                tempTreeNode1 =treeMenulist(treeNodes,node.getId());
                if(tempTreeNode1.isEmpty()){
                    lastChilNode.add(node);
                }
                childNode.add(node);
                tempTreeNode.add(node);
            }
        }

        return  tempTreeNode;

    }

    public static void main(String[] args) {
    }
}
